﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyDDD
{
    public class BusinessException : Exception
    {
        public BusinessException(string title, string message = "")
        {
            this.Code = 500;
            this.Title = title;
            this.Message = message;
        }

        public BusinessException(int code, string title, string message = "")
        {
            this.Code = code;
            this.Title = title;
            this.Message = message;
        }

        public BusinessException(Exception ex)
        {
            this.Exception = ex;
        }
        public Exception? Exception { get; private set; } = default!;


        public int Code { get; set; } = 500;
        public string Title { get; set; } = default!;
        public new string Message { get; set; } = default!;
        public List<dynamic> Errors { get; set; } = default!;
    }
}
